package com.geekaca.testthread;

public class HelloThread {
    public static void main(String[] args) {
//        System.out.println("Hello");
//        for (int i = 0; i < 100; i++) {
//            System.out.println(i);
//        }
//        System.out.println("bye");

        MyThred myThred = new MyThred("===task1");
//        myThred.setName("===task1");
        myThred.start();

//        Scanner scanner = new Scanner(System.in);
//        String next = scanner.next();
//        System.out.println(next);

        Thread sw = new ShowThread();
        sw.setName("===task2");
        sw.start();
    }


}

class MyThred extends Thread {
    public MyThred(String s) {
        this.setName(s);
    }

    @Override
    public void run() {
//        super.run();
        for (int i = 0; i < 10000; i++) {
            System.out.println(Thread.currentThread().getName() + "i: " + i);
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }

        }
    }
}

class ShowThread extends Thread {
    @Override
    public void run() {
        super.run();
        for (int i = 0; i < 10000; i++) {
            try {
                Thread.sleep(2000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            System.out.println("hello");


        }
    }
}
